//
//  CommendView.m
//  XRmenu
//
//  Created by shengchao yang on 11-11-25.
//  Copyright 2011年 foxhis. All rights reserved.
//

#import "CommendView.h"
#import "CommendTableOut.h"
#import "XRmenuHelper.h"

#define kTagOfStartCommendView 5810

@implementation CommendView
-(id) initWithStyle:(NSString *)stylename ViewName:(NSString *)vname
{
    self = [super initWithStyle:stylename ViewName:vname]; 
    if (self) {        
        //实例化CommendTableOut对象
        CommendTableOut *ctv=[[CommendTableOut alloc] initWithStyle:APPSESSION.uistyle ViewName:@"Commend View/CommendTableOut View"];
        ctv.tag=kTagOfStartCommendView;
        ctv.hidden=YES;
        [self addSubview:ctv];
        [ctv release];
    }
    return self;
}

#pragma mark 重载button处理方法
-(void) buttonClicked:(id)sender
{
	NSInteger bid = [sender tag];
    if(bid == (kTagOfStartBT + 0)){        
        DebugLog(@"显示或隐藏主厨推荐");
        [APPSESSION playSoundOnEvent:[XRmenuPublic getGeneralSkinImg:@"buttonClicked.caf"]];
        [(CommendTableOut *)[self viewWithTag:kTagOfStartCommendView] checkSubviewAppear];
    }
	else if (bid == (kTagOfStartBT + 1)) {
        if (APPSESSION.isAnimating) {
            DebugLog(@"动画还未结束...");
            return;
        }
        DebugLog(@"退回到语言和菜本选择界面");
        APPSESSION.isViewRemoveFromLef=NO;
        [APPSESSION playSoundOnEvent:[XRmenuPublic getGeneralSkinImg:@"buttonClicked.caf"]];
        NSDictionary *infos1 = [NSDictionary dictionaryWithObjectsAndKeys:num(ViewOfWelcome), @"Step", nil];
        postNWithInfos(kMessage_RootView_ChangeStep, self, infos1);
	}
    else if (bid == (kTagOfStartBT + 2)) {
        if (APPSESSION.isAnimating) {
            DebugLog(@"动画还未结束...");
            return;
        }
        DebugLog(@"进入点菜界面");
        APPSESSION.isViewRemoveFromLef=YES;
        [APPSESSION playSoundOnEvent:[XRmenuPublic getGeneralSkinImg:@"buttonClicked.caf"]];
        NSDictionary *infos1 = [NSDictionary dictionaryWithObjectsAndKeys:num(ViewOfProduct), @"Step", nil];
        postNWithInfos(kMessage_RootView_ChangeStep, self, infos1);
	}
}
//=========================================================== 
// dealloc
//=========================================================== 
- (void)dealloc
{
    [super dealloc];
} 
@end